import java.util.Arrays;
import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        //int arr[] = {1,-5,6,2};
        //Arrays.sort(arr);
        //System.out.println(Arrays.toString(arr));



        Scanner scan = new Scanner(System.in);
        String str = scan.next();
        String srr[] = str.split(",");



        /*for(int i = 0; i<100;i++){
            System.out.println(srr[i]);
        }*/


        int arr[] = new int [srr.length];
        int crr[] = new int [srr.length];
        int num = 0;
        for(int i = 0 ; i<srr.length; i++){
            arr[i] = Integer.parseInt(srr[i]);
            crr[i] = arr[i];
        }




        //Arrays.sort(arr);






        //sort(arr,0,arr.length-1);





        /*int count =0;

        for(int i = 0 ; i<srr.length; i++){
           if(arr[i] == crr[i]){
            count++;
           }else{
               break;
           }
        }
        System.out.println(count);*/


        /*int arr[] = new int [10000];
        for(int i =0; i<arr.length; i++){
            arr[i] = i+1;
        }*/



        int max = 0;
        int tmp = 0;
        boolean falg = false;
        for(int i =0; i<arr.length; i++){
            tmp = 0;
            falg = false;
            for(int j = i+1; j<arr.length;j++){
                if(arr[i]>arr[j]){
                    break;
                }
                if(arr[i]<arr[j] && !falg){
                    falg = true;
                    tmp++;
                    continue;
                }
                if(arr[j-1]>=arr[j]){
                    break;
                }
                if(falg){
                    if(arr[j-1]<arr[j]){
                        tmp++;
                    }

                }


            }
            max = Math.max(tmp,max);
        }
        //return (max+1);
    }


    public static void sort(int arr[],int left,int right){
        int l = left;
        int r = right;
        int mid = arr[(left+right)/2];
        int temp = 0;

        while (l<r){
            while (arr[l]<mid){
                l++;
            }
            while (arr[r]>mid){
                r--;
            }
            if(l>=r){
                break;
            }
            temp = arr[l];
            arr[l] = arr[r];
            arr[r] = temp;

            if(arr[l] == mid){
                r--;
            }
            if(arr[r] == mid){
                l++;
            }
        }

        if(l==r){
            l++;r--;
        }
        if(left<r){
            sort(arr,left,r);
        }
        if(right>l){
            sort(arr,l,right);
        }
    }
}
